import request from "../tools/request";
import qs from "qs";
export function query(data) {
  return request({
    url: "python/getGoodList",
    method: "get",
    headers: {
      "content-type": "application/json;charset=UTF-8"
    },
    params: data || {}
  });
}

export function categorynum(data) {
  return request({
    url: "/python/categorynum",
    method: "post",
    headers: {
      "content-type": "application/json;charset=UTF-8"
    },
    data: data || {}
  });
}

export function getCategoryNameList(data) {
  return request({
    url: "/python/getCategoryNameList",
    method: "post",
    headers: {
      "content-type": "application/json;charset=UTF-8"
    },
    data: data || {}
  });
}

export function updateGood(data) {
  return request({
    url: "/python/updateGood",
    method: "post",
    headers: {
      "content-type": "application/json;charset=UTF-8"
    },
    data: data || {}
  });
}

export function addGoodclick(data) {
  return request({
    url: "/python/addGoodclick",
    method: "post",
    headers: {
      "content-type": "application/json;charset=UTF-8"
    },
    data: data || {}
  });
}

export function addOrder(data) {
  return request({
    url: "/python/addOrder",
    method: "post",
    headers: {
      "content-type": "application/json;charset=UTF-8"
    },
    data: data || {}
  });
}

export function getOrderList(data) {
  // return request({
  //   url: "/python/getOrderList",
  //   method: "post",
  //   headers: {
  //     "content-type": "application/json;charset=UTF-8"
  //   },
  //   data: data || {}
  // });
  return request.get(
    "/python/getOrderList?" +
      qs.stringify(data, {
        encode: true,
        arrayFormat: "brackets" // 设置数组的序列化，-> {a: [1,2]} => a[]=1&a[]=2,与jq序列化结果相同
      })
  );
}

export function updateOrder(data) {
  return request({
    url: "/python/updateOrder",
    method: "post",
    headers: {
      "content-type": "application/json;charset=UTF-8"
    },
    data: data || {}
  });
}
